package com.jwd.avmanager.test;

import com.jwd.avmanager.pojo.*;
import com.jwd.avmanager.repository.BDMybais;
import com.jwd.avmanager.util.JodaTimeUtil;

import java.nio.file.Path;
import java.nio.file.Paths;
import java.text.SimpleDateFormat;
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import java.util.Date;

public class Main {
    public static void main(String[] args) {
        String fullPath = "jwd006\\\\202505\\\\2025-05-19.txt";
        Path path = Paths.get(fullPath);
        String fileName = path.getFileName().toString(); // 2025-05-19.txt
        System.out.println(fileName);

        /**
         *  "yyyy-MM-dd"   年-月-日
         *
         * "yyyy/MM/dd"   年/月/日
         *
         * "yyyy.MM.dd"   年.月.日
         *
         * "yyyy-MM-dd HH:mm:ss"         年-月-日    时:分:秒
         *
         *  "yyyy/MM/dd HH:mm:ss"        年/月/日    时:分:秒
         *
         * "yyyy.MM.dd HH:mm:ss"        年.月.日    时:分:秒
         *
         * "yyyy-MM-dd HH:mm:ss SSS"         年-月-日    时:分:秒  毫秒
         */
//        String s = dateToString(new Date());
//        System.out.println(s);
//        String currentTime = JodaTimeUtil.getCurrentDate();
//        System.out.println(currentTime+ " 00:00:00.000");
//        sqlsStst();
//        System.out.println("登录");LoginV2();
//        System.out.println("退出");NotLogin2();
//        System.out.println("加入房间记录");getRTCAddRoomV2();
//        System.out.println("退出WebRTC房间");getRTCDelRoomV2();
//        System.out.println("GPS添加");getGpsSevaV2();
//        System.out.println("-WedRTC  聊天房间");getWedRTCSevaV2();
    }

    public static String dateToString(Date date) {
        SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss SSS");
        String dateStr = formatter.format(date);
        return dateStr;
    }
    public static void sqlsStst(){
        BDMybais instance = BDMybais.getInstance();
        SOSSaveV2 sosSaveSQL = instance.getSosSaveSQL(131);
        System.out.println(sosSaveSQL);
    }

    public static void LoginV2 (){
        TerminalLogin terminalLogin = new TerminalLogin();
        terminalLogin.setIMEI("8754521");
        terminalLogin.setDevNo("jwd001");
        terminalLogin.setSupportVideo(12);
        BDMybais instance = BDMybais.getInstance();
        TerminalLogin terminalLogin1 = instance.terminalLoginV2(terminalLogin);
        System.out.println(terminalLogin1);
    }

    public static void NotLogin2 (){
        TerminalUnLogin terminalUnLogin = new TerminalUnLogin();
        terminalUnLogin.setDev_idx(131);
        terminalUnLogin.setKeepOnLine(false);
        BDMybais instance = BDMybais.getInstance();
        boolean b = instance.terminalUnLogin2(terminalUnLogin);
        System.out.println(b);
    }

    public static void getRTCAddRoomV2 (){
        RTCAddRoom rtcAddRoom = new RTCAddRoom();
        rtcAddRoom.setUserID(13);
        rtcAddRoom.setRoomID(176);
        BDMybais instance = BDMybais.getInstance();
        RTCAddRoom rtcAddRoom1 = instance.getRTCAddRoomV2(rtcAddRoom);
        System.out.println(rtcAddRoom1);
    }



    public static void getRTCDelRoomV2 (){
        RTCAddRoom rtcAddRoom = new RTCAddRoom();
        rtcAddRoom.setUserID(13);
        rtcAddRoom.setRoomID(176);
        BDMybais instance = BDMybais.getInstance();
        RTCAddRoom rtcAddRoom1 = instance.getRTCDelRoomV2(rtcAddRoom);
        System.out.println(rtcAddRoom1);
    }

    public static void getGpsSevaV2 (){
        Gps gpsSeva = new Gps();
        BDMybais instance = BDMybais.getInstance();
        boolean gpsSevaV2 = instance.getGpsSevaV2(gpsSeva, 131);
        System.out.println(gpsSevaV2);

    }

    public static void getWedRTCSevaV2(){
        WebRtc wedRtc = new WebRtc();
        wedRtc.setUserID(13);
        BDMybais instance = BDMybais.getInstance();
        WebRtc wedRTCSevaV2 = instance.getWedRTCSevaV2(wedRtc);
        System.out.println(wedRTCSevaV2.toString());
    }

    public static void getWedRTCSeva(){
        WebRtc wedRtc = new WebRtc();
        wedRtc.setUserID(13);
        BDMybais instance = BDMybais.getInstance();
        WebRtc wedRTCSevaV2 = instance.getWedRTCSeva(wedRtc);
        System.out.println(wedRTCSevaV2.toString());
    }
}